<?php
	/**
	 * 获取签到抽奖列表
	 */
    class LotteryDrawList extends APIBase {
		
		public $tag = "LotteryDrawList";
    	public $isLogin = true;
		
		public function before() {
			$this->initCacheRedis();
			$this->initMysql();
			return true;
		}
		public function logic(){
			$playerID = $this->uid;
			$lotterylist = $this->cache_redis->keys("hrewardpool:*");
			$proplist = $this->cache_redis->keys("prop:*");
			$result = array();
			$lotterycount = count($lotterylist);
			if($lotterycount>0){
				for($i=1;$i<=$lotterycount;$i++){
					$list = $this->cache_redis->hGetAll("hrewardpool:".$i);
					$rewardArr = json_decode($list['reward']);
					$reward = array();
					foreach($rewardArr as $key=>$val){
						$proprow = $this->cache_redis->hGetAll("prop:".$key);
						$reward[] = array('name'=>$proprow['name'],'count'=>$val);
					}
					$result[] = array('reward'=>$reward);
				}
			$this->returnData($result);
			}
			
		}
		
        public function after() {
			$this->deinitCacheRedis();
		}
    }
?>
